using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using LiquidFireArts.Wormhole.Misc;

namespace Unibot
{
    class AnimatedPlatform : Element
    {

        public AnimatedPlatform(Texture2D tx, Shape shp, Vector2 pos)
        {
            animations = new List<Animation>();
            animations.Add(new Animation(64, 64, 0, 16));
            this.texture = tx;
            this.TypeA = new List<Shape>() { shp };
            this.TypeB = new List<Shape>();
            this.type = ElementType.Platform;
            this.physical_state = new PhysicalState();
            this.physical_state.position = pos;
            updateHitboxes(); // this only needs to happen on creation
        }
        public override void update(GameTime gt)
        {
            //for (int i = 0; i < animations.Count; i++)
            //{
            //    animations[i].updateFrames(gt);
            //}
            // Only support one animation for now
            animations[0].updateFrames(gt);
        }

        public override void onCollisionWith(Element other, GameTime gt)
        {
            // do nothing for a regular platfom
        }

        public override void Draw(SpriteBatch sb)
        {
            // TODO : change to draw only the current animation
            sb.Draw(texture, physical_state.position, animations[0].getNextFrame(), Color.White);

        }
    }
}
